Skip to content

CLI app support: hardened adapter, publish-api, proc.exec#31

Merged
Alexgodoroja merged 1 commit into
mainfrom
cli-app-support
Jun 22, 2026
Merged

CLI app support: hardened adapter, publish-api, proc.exec#31
Alexgodoroja merged 1 commit into
mainfrom
cli-app-support

Conversation

@Alexgodoroja

Copy link
Copy Markdown
Collaborator

Makes the CLI backend archetype real and end-to-end publishable, so an existing CLI can be fronted as an app: pilotctl appstore call <app> <args> translates into a local subprocess invocation.

Depends on pilot-protocol/app-store#24 (the proc.exec capability). This PR pins the app-store dep at that commit; re-pin to the merged SHA once #24 lands.

Scaffolder / generated adapter

  • Fix the cli main: it never compiled (an http-only cfg leaked into the cli path → declared and not used). The parse-only test missed it because unused-var is a type-check error, not a parse error — added a go build ./... compile test.
  • Passthrough method shape: a verbatim {"args":[...]} argv fronts the whole CLI, so every subcommand is reachable without enumerating it.
  • Hardened runner: scrubbed child env (+ backend.env_passthrough allow-list), bounded output (4 MiB), structured non-zero exit, deterministic flags, missing-${param} errors, optional stdin. No shell — argv is exec'd directly.
  • Manifest emits the proc.exec grant scoped to the command and protection: guarded.

publish-api (internal/publish + admin)

  • Submission gains a cli backend (type/command/env_passthrough) and a per-method cli route (args/params_as_flags/passthrough); Validate, ToConfig, and the live HelpPreview branch on backend type. Admin case report is backend-aware.

Tests

  • compile guard for generated cli output
  • publish-path e2e: a proc.exec cli app builds + clears the catalogue self-verify gate on all platforms
  • runtime e2e: the built adapter execs the fronted CLI over real IPC (enumerated + passthrough + non-zero exit)

🤖 Generated with Claude Code

Make the cli backend archetype real and end-to-end publishable, so an
existing CLI can be fronted as an app: 'pilotctl appstore call <app> <args>'
translates into a local subprocess invocation.

Scaffolder / generated adapter:
- Fix the cli main: it never compiled (http-only cfg leaked in) — now builds.
- Passthrough method shape: a verbatim {"args":[...]} argv fronts the whole
  CLI, so every subcommand is reachable without enumerating it.
- Hardened runner: scrubbed child env (+ backend.env_passthrough allowlist),
  bounded output, structured non-zero exit, deterministic flags, missing-param
  errors, stdin. No shell (argv exec'd directly).
- Manifest emits the proc.exec grant (scoped to the command) and protection
  guarded; bump app-store to the version that knows proc.exec.

publish-api (internal/publish + admin):
- Submission model gains a cli backend (type/command/env_passthrough) and a
  per-method cli route (args/params_as_flags/passthrough); Validate, ToConfig,
  and the live HelpPreview branch on backend type. Admin case report is
  backend-aware.

Tests:
- compile guard (parse-only test missed the unused-var that broke cli builds)
- publish-path e2e: a proc.exec cli app builds + clears the catalogue gate
- runtime e2e: the built adapter execs the fronted CLI over real IPC
  (enumerated + passthrough + non-zero exit).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Alexgodoroja Alexgodoroja merged commit 1d69d1c into main Jun 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant